package cn.tedu.yl.TJxm.controller;

import cn.tedu.yl.TCLX.pojo.nxtc;
import cn.tedu.yl.TJxm.pojo.TJXM;
import cn.tedu.yl.TJxm.service.TJXMService;
import cn.tedu.yl.base.response.JsonResult;
import cn.tedu.yl.base.response.PageData;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "体检项目模块")
@RestController
@RequestMapping("/v1/TJXM")
@Slf4j
public class TJXMController {

    @Autowired
    private TJXMService tjxmService;

    @GetMapping("selectTJXM")
    public JsonResult getAllTJXM() {
        PageData list = tjxmService.getAllTJXM();
        return JsonResult.ok(list);
    }

    @PostMapping("createTJXM")
    public JsonResult createTJXM(@RequestBody TJXM tjxm) {
        tjxmService.createTJXM(tjxm);
        return JsonResult.ok();
    }

    @PostMapping("delete/{id}")
    public JsonResult deleteTJXM(@PathVariable(value = "id") Long id) {
        tjxmService.deleteTJXM(id);
        return JsonResult.ok();
    }

//    查询新增接口中所属套餐列表
    @GetMapping("selectBySSTC")
    public JsonResult selectBySSTC() {
        List<nxtc> list = tjxmService.selectBySSTC();
        return JsonResult.ok(list);
    }
}
